﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Texture2D
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine.Bindings;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Internal;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Class that represents textures in C# code.</para>
  /// </summary>
  [NativeHeader("Runtime/Graphics/GeneratedTextures.h")]
  [NativeHeader("Runtime/Graphics/Texture2D.h")]
  [UsedByNativeCode]
  public sealed class Texture2D : Texture
  {
    internal const int streamingMipmapsPriorityMin = -128;
    internal const int streamingMipmapsPriorityMax = 127;

    /// <summary>
    ///   <para>The format of the pixel data in the texture (Read Only).</para>
    /// </summary>
    public extern TextureFormat format { [NativeName("GetTextureFormat"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>This property causes a texture to ignore the QualitySettings.masterTextureLimit.</para>
    /// </summary>
    public extern bool ignoreMipmapLimit { [NativeName("IgnoreMasterTextureLimit"), MethodImpl(MethodImplOptions.InternalCall)] get; [NativeName("SetIgnoreMasterTextureLimitAndReload"), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Gets a small Texture with all white pixels.</para>
    /// </summary>
    [StaticAccessor("builtintex", StaticAccessorType.DoubleColon)]
    public static extern Texture2D whiteTexture { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Gets a small Texture with all black pixels.</para>
    /// </summary>
    [StaticAccessor("builtintex", StaticAccessorType.DoubleColon)]
    public static extern Texture2D blackTexture { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Gets a small Texture with all red pixels.</para>
    /// </summary>
    [StaticAccessor("builtintex", StaticAccessorType.DoubleColon)]
    public static extern Texture2D redTexture { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Gets a small Texture with all gray pixels.</para>
    /// </summary>
    [StaticAccessor("builtintex", StaticAccessorType.DoubleColon)]
    public static extern Texture2D grayTexture { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Gets a small Texture with all gray pixels.</para>
    /// </summary>
    [StaticAccessor("builtintex", StaticAccessorType.DoubleColon)]
    public static extern Texture2D linearGrayTexture { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Gets a small Texture with pixels that represent surface normal vectors at a neutral position.</para>
    /// </summary>
    [StaticAccessor("builtintex", StaticAccessorType.DoubleColon)]
    public static extern Texture2D normalTexture { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Compress texture at runtime to DXT/BCn or ETC formats.</para>
    /// </summary>
    /// <param name="highQuality"></param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void Compress(bool highQuality);

    [FreeFunction("Texture2DScripting::Create")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool Internal_CreateImpl(
      [Writable] Texture2D mono,
      int w,
      int h,
      int mipCount,
      GraphicsFormat format,
      TextureColorSpace colorSpace,
      TextureCreationFlags flags,
      IntPtr nativeTex);

    private static void Internal_Create(
      [Writable] Texture2D mono,
      int w,
      int h,
      int mipCount,
      GraphicsFormat format,
      TextureColorSpace colorSpace,
      TextureCreationFlags flags,
      IntPtr nativeTex)
    {
      if (!Texture2D.Internal_CreateImpl(mono, w, h, mipCount, format, colorSpace, flags, nativeTex))
        throw new UnityException("Failed to create texture because of invalid parameters.");
    }

    public override extern bool isReadable { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Returns true if the VTOnly checkbox was checked when the texture was imported; otherwise returns false. For additional information, see TextureImporter.vtOnly.</para>
    /// </summary>
    [NativeName("VTOnly")]
    [NativeConditional("ENABLE_VIRTUALTEXTURING && UNITY_EDITOR")]
    public extern bool vtOnly { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [NativeName("Apply")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void ApplyImpl(bool updateMipmaps, bool makeNoLongerReadable);

    [NativeName("Reinitialize")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool ReinitializeImpl(int width, int height);

    [NativeName("SetPixel")]
    private void SetPixelImpl(int image, int mip, int x, int y, Color color)
    {
      this.SetPixelImpl_Injected(image, mip, x, y, ref color);
    }

    [NativeName("GetPixel")]
    private Color GetPixelImpl(int image, int mip, int x, int y)
    {
      Color ret;
      this.GetPixelImpl_Injected(image, mip, x, y, out ret);
      return ret;
    }

    [NativeName("GetPixelBilinear")]
    private Color GetPixelBilinearImpl(int image, int mip, float u, float v)
    {
      Color ret;
      this.GetPixelBilinearImpl_Injected(image, mip, u, v, out ret);
      return ret;
    }

    [FreeFunction(Name = "Texture2DScripting::ReinitializeWithFormat", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool ReinitializeWithFormatImpl(
      int width,
      int height,
      GraphicsFormat format,
      bool hasMipMap);

    [FreeFunction(Name = "Texture2DScripting::ReadPixels", HasExplicitThis = true)]
    private void ReadPixelsImpl(Rect source, int destX, int destY, bool recalculateMipMaps)
    {
      this.ReadPixelsImpl_Injected(ref source, destX, destY, recalculateMipMaps);
    }

    [FreeFunction(Name = "Texture2DScripting::SetPixels", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetPixelsImpl(
      int x,
      int y,
      int w,
      int h,
      Color[] pixel,
      int miplevel,
      int frame);

    [FreeFunction(Name = "Texture2DScripting::LoadRawData", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool LoadRawTextureDataImpl(IntPtr data, ulong size);

    [FreeFunction(Name = "Texture2DScripting::LoadRawData", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool LoadRawTextureDataImplArray(byte[] data);

    [FreeFunction(Name = "Texture2DScripting::SetPixelDataArray", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool SetPixelDataImplArray(
      Array data,
      int mipLevel,
      int elementSize,
      int dataArraySize,
      int sourceDataStartIndex = 0);

    [FreeFunction(Name = "Texture2DScripting::SetPixelData", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool SetPixelDataImpl(
      IntPtr data,
      int mipLevel,
      int elementSize,
      int dataArraySize,
      int sourceDataStartIndex = 0);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern IntPtr GetWritableImageData(int frame);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern ulong GetRawImageDataSize();

    private static AtomicSafetyHandle GetSafetyHandle(Texture2D tex)
    {
      AtomicSafetyHandle ret;
      Texture2D.GetSafetyHandle_Injected(tex, out ret);
      return ret;
    }

    private AtomicSafetyHandle GetSafetyHandleForSlice(int mipLevel)
    {
      AtomicSafetyHandle ret;
      this.GetSafetyHandleForSlice_Injected(mipLevel, out ret);
      return ret;
    }

    [FreeFunction("Texture2DScripting::GenerateAtlas")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GenerateAtlasImpl(
      Vector2[] sizes,
      int padding,
      int atlasSize,
      [Out] Rect[] rect);

    internal extern bool isPreProcessed { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Determines whether mipmap streaming is enabled for this Texture.</para>
    /// </summary>
    public extern bool streamingMipmaps { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Sets the relative priority for this Texture when reducing memory size to fit within the memory budget.</para>
    /// </summary>
    public extern int streamingMipmapsPriority { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>The mipmap level to load.</para>
    /// </summary>
    public extern int requestedMipmapLevel { [FreeFunction(Name = "GetTextureStreamingManager().GetRequestedMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction(Name = "GetTextureStreamingManager().SetRequestedMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Restricts the mipmap streaming system to a minimum mip level for this Texture.</para>
    /// </summary>
    public extern int minimumMipmapLevel { [FreeFunction(Name = "GetTextureStreamingManager().GetMinimumMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction(Name = "GetTextureStreamingManager().SetMinimumMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    internal extern bool loadAllMips { [FreeFunction(Name = "GetTextureStreamingManager().GetLoadAllMips", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction(Name = "GetTextureStreamingManager().SetLoadAllMips", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The mipmap level calculated by the streaming system, which takes into account the streaming Cameras and the location of the objects containing this Texture. This is unaffected by requestedMipmapLevel or minimumMipmapLevel.</para>
    /// </summary>
    public extern int calculatedMipmapLevel { [FreeFunction(Name = "GetTextureStreamingManager().GetCalculatedMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>The mipmap level that the streaming system would load before memory budgets are applied.</para>
    /// </summary>
    public extern int desiredMipmapLevel { [FreeFunction(Name = "GetTextureStreamingManager().GetDesiredMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>The mipmap level that the mipmap streaming system is in the process of loading.</para>
    /// </summary>
    public extern int loadingMipmapLevel { [FreeFunction(Name = "GetTextureStreamingManager().GetLoadingMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>The mipmap level that is currently loaded by the streaming system.</para>
    /// </summary>
    public extern int loadedMipmapLevel { [FreeFunction(Name = "GetTextureStreamingManager().GetLoadedMipmapLevel", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Resets the requestedMipmapLevel field.</para>
    /// </summary>
    [FreeFunction(Name = "GetTextureStreamingManager().ClearRequestedMipmapLevel", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void ClearRequestedMipmapLevel();

    /// <summary>
    ///   <para>Checks to see whether the mipmap level set by requestedMipmapLevel has finished loading.</para>
    /// </summary>
    /// <returns>
    ///   <para>True if the mipmap level requested by requestedMipmapLevel has finished loading.</para>
    /// </returns>
    [FreeFunction(Name = "GetTextureStreamingManager().IsRequestedMipmapLevelLoaded", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern bool IsRequestedMipmapLevelLoaded();

    /// <summary>
    ///   <para>Resets the minimumMipmapLevel field.</para>
    /// </summary>
    [FreeFunction(Name = "GetTextureStreamingManager().ClearMinimumMipmapLevel", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void ClearMinimumMipmapLevel();

    /// <summary>
    ///   <para>Updates Unity texture to use different native texture object.</para>
    /// </summary>
    /// <param name="nativeTex">Native 2D texture object.</param>
    [FreeFunction("Texture2DScripting::UpdateExternalTexture", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void UpdateExternalTexture(IntPtr nativeTex);

    [FreeFunction("Texture2DScripting::SetAllPixels32", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetAllPixels32([Unmarshalled] Color32[] colors, int miplevel);

    [FreeFunction("Texture2DScripting::SetBlockOfPixels32", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetBlockOfPixels32(
      int x,
      int y,
      int blockWidth,
      int blockHeight,
      [Unmarshalled] Color32[] colors,
      int miplevel);

    /// <summary>
    ///   <para>Gets the raw data from a texture, as an array that points to memory.</para>
    /// </summary>
    /// <returns>
    ///   <para>A native array that points directly to the texture's data buffer in CPU memory.</para>
    /// </returns>
    [FreeFunction("Texture2DScripting::GetRawTextureData", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern byte[] GetRawTextureData();

    /// <summary>
    ///   <para>Gets the pixel color data for part of a mipmap level as Color structs.</para>
    /// </summary>
    /// <param name="x">The starting x position of the section to fetch.</param>
    /// <param name="y">The starting y position of the section to fetch.</param>
    /// <param name="blockWidth">The width of the section to fetch.</param>
    /// <param name="blockHeight">The height of the section to fetch.</param>
    /// <param name="miplevel">The mipmap level to read from. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>An array that contains the pixel colors.</para>
    /// </returns>
    [FreeFunction("Texture2DScripting::GetPixels", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern Color[] GetPixels(int x, int y, int blockWidth, int blockHeight, [DefaultValue("0")] int miplevel);

    /// <summary>
    ///   <para>Gets the pixel color data for part of a mipmap level as Color structs.</para>
    /// </summary>
    /// <param name="x">The starting x position of the section to fetch.</param>
    /// <param name="y">The starting y position of the section to fetch.</param>
    /// <param name="blockWidth">The width of the section to fetch.</param>
    /// <param name="blockHeight">The height of the section to fetch.</param>
    /// <param name="miplevel">The mipmap level to read from. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>An array that contains the pixel colors.</para>
    /// </returns>
    [ExcludeFromDocs]
    public Color[] GetPixels(int x, int y, int blockWidth, int blockHeight)
    {
      return this.GetPixels(x, y, blockWidth, blockHeight, 0);
    }

    /// <summary>
    ///   <para>Gets the pixel color data for a mipmap level as Color32 structs.</para>
    /// </summary>
    /// <param name="miplevel">The mipmap level to get. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>An array that contains the pixel colors.</para>
    /// </returns>
    [FreeFunction("Texture2DScripting::GetPixels32", HasExplicitThis = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern Color32[] GetPixels32([DefaultValue("0")] int miplevel);

    [ExcludeFromDocs]
    public Color32[] GetPixels32() => this.GetPixels32(0);

    /// <summary>
    ///   <para>Packs multiple Textures into a texture atlas.</para>
    /// </summary>
    /// <param name="textures">Array of textures to pack into the atlas.</param>
    /// <param name="padding">Padding in pixels between the packed textures.</param>
    /// <param name="maximumAtlasSize">Maximum size of the resulting texture.</param>
    /// <param name="makeNoLongerReadable">Should the texture be marked as no longer readable?</param>
    /// <returns>
    ///   <para>An array of rectangles containing the UV coordinates in the atlas for each input texture, or null if packing fails.</para>
    /// </returns>
    [FreeFunction("Texture2DScripting::PackTextures", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern Rect[] PackTextures(
      Texture2D[] textures,
      int padding,
      int maximumAtlasSize,
      bool makeNoLongerReadable);

    public Rect[] PackTextures(Texture2D[] textures, int padding, int maximumAtlasSize)
    {
      return this.PackTextures(textures, padding, maximumAtlasSize, false);
    }

    public Rect[] PackTextures(Texture2D[] textures, int padding)
    {
      return this.PackTextures(textures, padding, 2048);
    }

    /// <summary>
    ///   <para>Indicates whether this texture was imported with TextureImporter.alphaIsTransparency enabled. This setting is available only in the Editor scripts. Note that changing this setting will have no effect; it must be enabled in TextureImporter instead.</para>
    /// </summary>
    public extern bool alphaIsTransparency { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    [VisibleToOtherModules(new string[] {"UnityEngine.UIElementsModule", "Unity.UIElements"})]
    internal extern float pixelsPerPoint { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    internal bool ValidateFormat(TextureFormat format, int width, int height)
    {
      bool flag = this.ValidateFormat(format);
      if (flag && TextureFormat.PVRTC_RGB2 <= format && format <= TextureFormat.PVRTC_RGBA4 && (width != height || !Mathf.IsPowerOfTwo(width)))
        throw new UnityException(string.Format("'{0}' demands texture to be square and have power-of-two dimensions", (object) format.ToString()));
      return flag;
    }

    internal bool ValidateFormat(GraphicsFormat format, int width, int height)
    {
      bool flag = this.ValidateFormat(format, FormatUsage.Sample);
      if (flag && GraphicsFormatUtility.IsPVRTCFormat(format) && (width != height || !Mathf.IsPowerOfTwo(width)))
        throw new UnityException(string.Format("'{0}' demands texture to be square and have power-of-two dimensions", (object) format.ToString()));
      return flag;
    }

    internal Texture2D(
      int width,
      int height,
      GraphicsFormat format,
      TextureCreationFlags flags,
      int mipCount,
      IntPtr nativeTex)
    {
      if (!this.ValidateFormat(format, width, height))
        return;
      Texture2D.Internal_Create(this, width, height, mipCount, format, this.GetTextureColorSpace(format), flags, nativeTex);
    }

    [ExcludeFromDocs]
    public Texture2D(int width, int height, DefaultFormat format, TextureCreationFlags flags)
      : this(width, height, SystemInfo.GetGraphicsFormat(format), flags)
    {
    }

    [ExcludeFromDocs]
    public Texture2D(int width, int height, GraphicsFormat format, TextureCreationFlags flags)
      : this(width, height, format, flags, Texture.GenerateAllMips, IntPtr.Zero)
    {
    }

    [ExcludeFromDocs]
    public Texture2D(
      int width,
      int height,
      GraphicsFormat format,
      int mipCount,
      TextureCreationFlags flags)
      : this(width, height, format, flags, mipCount, IntPtr.Zero)
    {
    }

    internal Texture2D(
      int width,
      int height,
      TextureFormat textureFormat,
      int mipCount,
      bool linear,
      IntPtr nativeTex)
    {
      if (!this.ValidateFormat(textureFormat, width, height))
        return;
      GraphicsFormat graphicsFormat = GraphicsFormatUtility.GetGraphicsFormat(textureFormat, !linear);
      TextureCreationFlags flags = mipCount != 1 ? TextureCreationFlags.MipChain : TextureCreationFlags.None;
      if (GraphicsFormatUtility.IsCrunchFormat(textureFormat))
        flags |= TextureCreationFlags.Crunch;
      Texture2D.Internal_Create(this, width, height, mipCount, graphicsFormat, this.GetTextureColorSpace(linear), flags, nativeTex);
    }

    /// <summary>
    ///   <para>Create a new empty texture.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="textureFormat"></param>
    /// <param name="mipCount"></param>
    /// <param name="linear"></param>
    public Texture2D(
      int width,
      int height,
      [DefaultValue("TextureFormat.RGBA32")] TextureFormat textureFormat,
      [DefaultValue("-1")] int mipCount,
      [DefaultValue("false")] bool linear)
      : this(width, height, textureFormat, mipCount, linear, IntPtr.Zero)
    {
    }

    /// <summary>
    ///   <para>Create a new empty texture.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="textureFormat"></param>
    /// <param name="mipChain"></param>
    /// <param name="linear"></param>
    public Texture2D(
      int width,
      int height,
      [DefaultValue("TextureFormat.RGBA32")] TextureFormat textureFormat,
      [DefaultValue("true")] bool mipChain,
      [DefaultValue("false")] bool linear)
      : this(width, height, textureFormat, mipChain ? -1 : 1, linear, IntPtr.Zero)
    {
    }

    /// <summary>
    ///   <para>Create a new empty texture.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="textureFormat"></param>
    /// <param name="mipChain"></param>
    /// <param name="linear"></param>
    [ExcludeFromDocs]
    public Texture2D(int width, int height, TextureFormat textureFormat, bool mipChain)
      : this(width, height, textureFormat, mipChain ? -1 : 1, false, IntPtr.Zero)
    {
    }

    /// <summary>
    ///   <para>Create a new empty texture.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="textureFormat"></param>
    /// <param name="mipCount"></param>
    /// <param name="linear"></param>
    [ExcludeFromDocs]
    public Texture2D(int width, int height)
      : this(width, height, TextureFormat.RGBA32, Texture.GenerateAllMips, false, IntPtr.Zero)
    {
    }

    /// <summary>
    ///   <para>Creates a Unity Texture out of an externally created native texture object.</para>
    /// </summary>
    /// <param name="nativeTex">Native 2D texture object.</param>
    /// <param name="width">Width of texture in pixels.</param>
    /// <param name="height">Height of texture in pixels.</param>
    /// <param name="format">Format of underlying texture object.</param>
    /// <param name="mipmap">Does the texture have mipmaps?</param>
    /// <param name="linear">Is texture using linear color space?</param>
    /// <param name="mipChain"></param>
    public static Texture2D CreateExternalTexture(
      int width,
      int height,
      TextureFormat format,
      bool mipChain,
      bool linear,
      IntPtr nativeTex)
    {
      if (nativeTex == IntPtr.Zero)
        throw new ArgumentException("nativeTex can not be null");
      return new Texture2D(width, height, format, mipChain ? -1 : 1, linear, nativeTex);
    }

    /// <summary>
    ///   <para>Sets the pixel color at coordinates (x,y).</para>
    /// </summary>
    /// <param name="x">The x coordinate of the pixel to set. The range is 0 through (texture width - 1).</param>
    /// <param name="y">The y coordinate of the pixel to set. The range is 0 through (texture height - 1).</param>
    /// <param name="color">The color to set.</param>
    /// <param name="mipLevel">The mipmap level to write to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    [ExcludeFromDocs]
    public void SetPixel(int x, int y, Color color)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      this.SetPixelImpl(0, 0, x, y, color);
    }

    /// <summary>
    ///   <para>Sets the pixel color at coordinates (x,y).</para>
    /// </summary>
    /// <param name="x">The x coordinate of the pixel to set. The range is 0 through (texture width - 1).</param>
    /// <param name="y">The y coordinate of the pixel to set. The range is 0 through (texture height - 1).</param>
    /// <param name="color">The color to set.</param>
    /// <param name="mipLevel">The mipmap level to write to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    public void SetPixel(int x, int y, Color color, [DefaultValue("0")] int mipLevel)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      this.SetPixelImpl(0, mipLevel, x, y, color);
    }

    /// <summary>
    ///   <para>Sets the pixel colors of part of a mipmap level.</para>
    /// </summary>
    /// <param name="x">The x coordinate to place the block of pixels at. The range is 0 through (texture width - 1).</param>
    /// <param name="y">The y coordinate to place the block of pixels at. The range is 0 through (texture height - 1).</param>
    /// <param name="blockWidth">The width of the block of pixels to set.</param>
    /// <param name="blockHeight">The height of the block of pixels to set.</param>
    /// <param name="colors">The array of pixel colours to use. This is a 2D image flattened to a 1D array. Must be blockWidth x blockHeight in length.</param>
    /// <param name="miplevel">The mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    public void SetPixels(
      int x,
      int y,
      int blockWidth,
      int blockHeight,
      Color[] colors,
      [DefaultValue("0")] int miplevel)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      this.SetPixelsImpl(x, y, blockWidth, blockHeight, colors, miplevel, 0);
    }

    [ExcludeFromDocs]
    public void SetPixels(int x, int y, int blockWidth, int blockHeight, Color[] colors)
    {
      this.SetPixels(x, y, blockWidth, blockHeight, colors, 0);
    }

    /// <summary>
    ///   <para>Sets the pixel colors of an entire mipmap level.</para>
    /// </summary>
    /// <param name="colors">The array of pixel colours to use. This is a 2D image flattened to a 1D array.</param>
    /// <param name="miplevel">The mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    public void SetPixels(Color[] colors, [DefaultValue("0")] int miplevel)
    {
      int blockWidth = this.width >> miplevel;
      if (blockWidth < 1)
        blockWidth = 1;
      int blockHeight = this.height >> miplevel;
      if (blockHeight < 1)
        blockHeight = 1;
      this.SetPixels(0, 0, blockWidth, blockHeight, colors, miplevel);
    }

    [ExcludeFromDocs]
    public void SetPixels(Color[] colors)
    {
      this.SetPixels(0, 0, this.width, this.height, colors, 0);
    }

    /// <summary>
    ///   <para>Gets the pixel color at coordinates (x, y).</para>
    /// </summary>
    /// <param name="x">The x coordinate of the pixel to get. The range is 0 through (texture width - 1).</param>
    /// <param name="y">The y coordinate of the pixel to get. The range is 0 through (texture height - 1).</param>
    /// <param name="mipLevel">The mipmap level to sample. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>The pixel color.</para>
    /// </returns>
    [ExcludeFromDocs]
    public Color GetPixel(int x, int y)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      return this.GetPixelImpl(0, 0, x, y);
    }

    /// <summary>
    ///   <para>Gets the pixel color at coordinates (x, y).</para>
    /// </summary>
    /// <param name="x">The x coordinate of the pixel to get. The range is 0 through (texture width - 1).</param>
    /// <param name="y">The y coordinate of the pixel to get. The range is 0 through (texture height - 1).</param>
    /// <param name="mipLevel">The mipmap level to sample. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>The pixel color.</para>
    /// </returns>
    public Color GetPixel(int x, int y, [DefaultValue("0")] int mipLevel)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      return this.GetPixelImpl(0, mipLevel, x, y);
    }

    /// <summary>
    ///   <para>Gets the filtered pixel color at the normalized coordinates (u, v).</para>
    /// </summary>
    /// <param name="u">The u coordinate of the pixel to get.</param>
    /// <param name="v">The v coordinate of the pixel to get.</param>
    /// <param name="mipLevel">The mipmap level to read from. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>The pixel color.</para>
    /// </returns>
    [ExcludeFromDocs]
    public Color GetPixelBilinear(float u, float v)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      return this.GetPixelBilinearImpl(0, 0, u, v);
    }

    /// <summary>
    ///   <para>Gets the filtered pixel color at the normalized coordinates (u, v).</para>
    /// </summary>
    /// <param name="u">The u coordinate of the pixel to get.</param>
    /// <param name="v">The v coordinate of the pixel to get.</param>
    /// <param name="mipLevel">The mipmap level to read from. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>The pixel color.</para>
    /// </returns>
    public Color GetPixelBilinear(float u, float v, [DefaultValue("0")] int mipLevel)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      return this.GetPixelBilinearImpl(0, mipLevel, u, v);
    }

    /// <summary>
    ///   <para>Sets the raw data of an entire texture in CPU memory.</para>
    /// </summary>
    /// <param name="data">The array of data to use.</param>
    /// <param name="size">The size of the data in bytes.</param>
    public void LoadRawTextureData(IntPtr data, int size)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      if (data == IntPtr.Zero || size == 0)
        Debug.LogError((object) "No texture data provided to LoadRawTextureData", (Object) this);
      else if (!this.LoadRawTextureDataImpl(data, (ulong) size))
        throw new UnityException("LoadRawTextureData: not enough data provided (will result in overread).");
    }

    /// <summary>
    ///   <para>Sets the raw data of an entire texture in CPU memory.</para>
    /// </summary>
    /// <param name="data">The array of data to use.</param>
    /// <param name="size">The size of the data in bytes.</param>
    public void LoadRawTextureData(byte[] data)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      if (data == null || data.Length == 0)
        Debug.LogError((object) "No texture data provided to LoadRawTextureData", (Object) this);
      else if (!this.LoadRawTextureDataImplArray(data))
        throw new UnityException("LoadRawTextureData: not enough data provided (will result in overread).");
    }

    public unsafe void LoadRawTextureData<T>(NativeArray<T> data) where T : struct
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      if (!data.IsCreated || data.Length == 0)
        throw new UnityException("No texture data provided to LoadRawTextureData");
      if (!this.LoadRawTextureDataImpl((IntPtr) data.GetUnsafeReadOnlyPtr<T>(), (ulong) data.Length * (ulong) UnsafeUtility.SizeOf<T>()))
        throw new UnityException("LoadRawTextureData: not enough data provided (will result in overread).");
    }

    public void SetPixelData<T>(T[] data, int mipLevel, [DefaultValue("0")] int sourceDataStartIndex = 0)
    {
      if (sourceDataStartIndex < 0)
        throw new UnityException("SetPixelData: sourceDataStartIndex cannot be less than 0.");
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      if (data == null || data.Length == 0)
        throw new UnityException("No texture data provided to SetPixelData.");
      this.SetPixelDataImplArray((Array) data, mipLevel, Marshal.SizeOf((object) data[0]), data.Length, sourceDataStartIndex);
    }

    public unsafe void SetPixelData<T>(NativeArray<T> data, int mipLevel, [DefaultValue("0")] int sourceDataStartIndex = 0) where T : struct
    {
      if (sourceDataStartIndex < 0)
        throw new UnityException("SetPixelData: sourceDataStartIndex cannot be less than 0.");
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      if (!data.IsCreated || data.Length == 0)
        throw new UnityException("No texture data provided to SetPixelData.");
      this.SetPixelDataImpl((IntPtr) data.GetUnsafeReadOnlyPtr<T>(), mipLevel, UnsafeUtility.SizeOf<T>(), data.Length, sourceDataStartIndex);
    }

    public unsafe NativeArray<T> GetPixelData<T>(int mipLevel) where T : struct
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      if (mipLevel < 0 || mipLevel >= this.mipmapCount)
        throw new ArgumentException("The passed in miplevel " + mipLevel.ToString() + " is invalid. It needs to be in the range 0 and " + (this.mipmapCount - 1).ToString());
      if (this.GetWritableImageData(0).ToInt64() == 0L)
        throw new UnityException("Texture '" + this.name + "' has no data.");
      ulong pixelDataOffset = this.GetPixelDataOffset(mipLevel);
      ulong length = this.GetPixelDataSize(mipLevel) / (ulong) UnsafeUtility.SizeOf<T>();
      NativeArray<T> array = length <= (ulong) int.MaxValue ? NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<T>((void*) new IntPtr((long) this.GetWritableImageData(0) + (long) pixelDataOffset), (int) length, Allocator.None) : throw this.CreateNativeArrayLengthOverflowException();
      NativeArrayUnsafeUtility.SetAtomicSafetyHandle<T>(ref array, this.GetSafetyHandleForSlice(mipLevel));
      return array;
    }

    public unsafe NativeArray<T> GetRawTextureData<T>() where T : struct
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      int num = UnsafeUtility.SizeOf<T>();
      ulong length = this.GetRawImageDataSize() / (ulong) num;
      NativeArray<T> array = length <= (ulong) int.MaxValue ? NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<T>((void*) this.GetWritableImageData(0), (int) length, Allocator.None) : throw this.CreateNativeArrayLengthOverflowException();
      NativeArrayUnsafeUtility.SetAtomicSafetyHandle<T>(ref array, Texture2D.GetSafetyHandle(this));
      return array;
    }

    /// <summary>
    ///   <para>Copies changes you've made in a CPU texture to the GPU.</para>
    /// </summary>
    /// <param name="updateMipmaps">When the value is true, Unity recalculates mipmap levels, using mipmap level 0 as the source. The default value is true.</param>
    /// <param name="makeNoLongerReadable">When the value is true, Unity deletes the texture in CPU memory after it uploads it to the GPU, and sets Texture.isReadable|isReadable to false. The default value is false.</param>
    public void Apply([DefaultValue("true")] bool updateMipmaps, [DefaultValue("false")] bool makeNoLongerReadable)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      this.ApplyImpl(updateMipmaps, makeNoLongerReadable);
    }

    [ExcludeFromDocs]
    public void Apply(bool updateMipmaps) => this.Apply(updateMipmaps, false);

    [ExcludeFromDocs]
    public void Apply() => this.Apply(true, false);

    /// <summary>
    ///   <para>Reinitializes a Texture2D, making it possible for you to replace width, height, textureformat, and graphicsformat data for that texture.</para>
    /// </summary>
    /// <param name="width">New width of the Texture.</param>
    /// <param name="height">New height of the Texture.</param>
    /// <param name="format">New format of the Texture.</param>
    /// <param name="hasMipMap">Indicates if the Texture should reserve memory for a full mip map chain.</param>
    /// <returns>
    ///   <para>Returns true if the reinitialization was a success.</para>
    /// </returns>
    public bool Reinitialize(int width, int height)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      return this.ReinitializeImpl(width, height);
    }

    /// <summary>
    ///   <para>Reinitializes a Texture2D, making it possible for you to replace width, height, textureformat, and graphicsformat data for that texture.</para>
    /// </summary>
    /// <param name="width">New width of the Texture.</param>
    /// <param name="height">New height of the Texture.</param>
    /// <param name="format">New format of the Texture.</param>
    /// <param name="hasMipMap">Indicates if the Texture should reserve memory for a full mip map chain.</param>
    /// <returns>
    ///   <para>Returns true if the reinitialization was a success.</para>
    /// </returns>
    public bool Reinitialize(int width, int height, TextureFormat format, bool hasMipMap)
    {
      return this.ReinitializeWithFormatImpl(width, height, GraphicsFormatUtility.GetGraphicsFormat(format, this.activeTextureColorSpace == ColorSpace.Gamma), hasMipMap);
    }

    /// <summary>
    ///   <para>Reinitializes a Texture2D, making it possible for you to replace width, height, textureformat, and graphicsformat data for that texture.</para>
    /// </summary>
    /// <param name="width">New width of the Texture.</param>
    /// <param name="height">New height of the Texture.</param>
    /// <param name="format">New format of the Texture.</param>
    /// <param name="hasMipMap">Indicates if the Texture should reserve memory for a full mip map chain.</param>
    /// <returns>
    ///   <para>Returns true if the reinitialization was a success.</para>
    /// </returns>
    public bool Reinitialize(int width, int height, GraphicsFormat format, bool hasMipMap)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      return this.ReinitializeWithFormatImpl(width, height, format, hasMipMap);
    }

    /// <summary>
    ///   <para>Resizes the texture.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    [Obsolete("Texture2D.Resize(int, int) has been deprecated because it actually reinitializes the texture. Use Texture2D.Reinitialize(int, int) instead (UnityUpgradable) -> Reinitialize([*] System.Int32, [*] System.Int32)", false)]
    public bool Resize(int width, int height) => this.Reinitialize(width, height);

    /// <summary>
    ///   <para>Resizes the texture.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="format"></param>
    /// <param name="hasMipMap"></param>
    [Obsolete("Texture2D.Resize(int, int, TextureFormat, bool) has been deprecated because it actually reinitializes the texture. Use Texture2D.Reinitialize(int, int, TextureFormat, bool) instead (UnityUpgradable) -> Reinitialize([*] System.Int32, [*] System.Int32, UnityEngine.TextureFormat, [*] System.Boolean)", false)]
    public bool Resize(int width, int height, TextureFormat format, bool hasMipMap)
    {
      return this.Reinitialize(width, height, format, hasMipMap);
    }

    [Obsolete("Texture2D.Resize(int, int, GraphicsFormat, bool) has been deprecated because it actually reinitializes the texture. Use Texture2D.Reinitialize(int, int, GraphicsFormat, bool) instead (UnityUpgradable) -> Reinitialize([*] System.Int32, [*] System.Int32, UnityEngine.Experimental.Rendering.GraphicsFormat, [*] System.Boolean)", false)]
    public bool Resize(int width, int height, GraphicsFormat format, bool hasMipMap)
    {
      return this.Reinitialize(width, height, format, hasMipMap);
    }

    /// <summary>
    ///   <para>Reads pixels from the current render target and writes them to a texture.</para>
    /// </summary>
    /// <param name="source">The region of the render target to read from.</param>
    /// <param name="destX">The x position in the texture to write the pixels to.</param>
    /// <param name="destY">The y position in the texture to write the pixels to.</param>
    /// <param name="recalculateMipMaps">When the value is true, Unity automatically recalculates the mipmap for the texture after it writes the pixel data. Otherwise, Unity doesn't do this automatically.</param>
    public void ReadPixels(Rect source, int destX, int destY, [DefaultValue("true")] bool recalculateMipMaps)
    {
      if (!this.isReadable)
        throw this.CreateNonReadableException((Texture) this);
      this.ReadPixelsImpl(source, destX, destY, recalculateMipMaps);
    }

    [ExcludeFromDocs]
    public void ReadPixels(Rect source, int destX, int destY)
    {
      this.ReadPixels(source, destX, destY, true);
    }

    public static bool GenerateAtlas(
      Vector2[] sizes,
      int padding,
      int atlasSize,
      List<Rect> results)
    {
      if (sizes == null)
        throw new ArgumentException("sizes array can not be null");
      if (results == null)
        throw new ArgumentException("results list cannot be null");
      if (padding < 0)
        throw new ArgumentException("padding can not be negative");
      if (atlasSize <= 0)
        throw new ArgumentException("atlas size must be positive");
      results.Clear();
      if (sizes.Length == 0)
        return true;
      NoAllocHelpers.EnsureListElemCount<Rect>(results, sizes.Length);
      Texture2D.GenerateAtlasImpl(sizes, padding, atlasSize, NoAllocHelpers.ExtractArrayFromListT<Rect>(results));
      return results.Count != 0;
    }

    /// <summary>
    ///   <para>Sets the pixel colors of an entire mipmap level.</para>
    /// </summary>
    /// <param name="colors">The array of pixel colours to use. This is a 2D image flattened to a 1D array.</param>
    /// <param name="miplevel">The mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    public void SetPixels32(Color32[] colors, [DefaultValue("0")] int miplevel)
    {
      this.SetAllPixels32(colors, miplevel);
    }

    /// <summary>
    ///   <para>Sets the pixel colors of an entire mipmap level.</para>
    /// </summary>
    /// <param name="colors">The array of pixel colours to use. This is a 2D image flattened to a 1D array.</param>
    /// <param name="miplevel">The mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    [ExcludeFromDocs]
    public void SetPixels32(Color32[] colors) => this.SetPixels32(colors, 0);

    /// <summary>
    ///   <para>Sets the pixel colors of part of a mipmap level.</para>
    /// </summary>
    /// <param name="x">The x coordinate to place the block of pixels at. The range is 0 through (texture width - 1).</param>
    /// <param name="y">The y coordinate to place the block of pixels at. The range is 0 through (texture height - 1).</param>
    /// <param name="blockWidth">The width of the block of pixels to set.</param>
    /// <param name="blockHeight">The height of the block of pixels to set.</param>
    /// <param name="colors">The array of pixel colours to use. This is a 2D image flattened to a 1D array. Must be blockWidth x blockHeight in length.</param>
    /// <param name="miplevel">The mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    public void SetPixels32(
      int x,
      int y,
      int blockWidth,
      int blockHeight,
      Color32[] colors,
      [DefaultValue("0")] int miplevel)
    {
      this.SetBlockOfPixels32(x, y, blockWidth, blockHeight, colors, miplevel);
    }

    /// <summary>
    ///   <para>Sets the pixel colors of part of a mipmap level.</para>
    /// </summary>
    /// <param name="x">The x coordinate to place the block of pixels at. The range is 0 through (texture width - 1).</param>
    /// <param name="y">The y coordinate to place the block of pixels at. The range is 0 through (texture height - 1).</param>
    /// <param name="blockWidth">The width of the block of pixels to set.</param>
    /// <param name="blockHeight">The height of the block of pixels to set.</param>
    /// <param name="colors">The array of pixel colours to use. This is a 2D image flattened to a 1D array. Must be blockWidth x blockHeight in length.</param>
    /// <param name="miplevel">The mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    [ExcludeFromDocs]
    public void SetPixels32(int x, int y, int blockWidth, int blockHeight, Color32[] colors)
    {
      this.SetPixels32(x, y, blockWidth, blockHeight, colors, 0);
    }

    /// <summary>
    ///   <para>Gets the pixel color data for a mipmap level as Color structs.</para>
    /// </summary>
    /// <param name="miplevel">The mipmap level to get. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.</param>
    /// <returns>
    ///   <para>An array that contains the pixel colors.</para>
    /// </returns>
    public Color[] GetPixels([DefaultValue("0")] int miplevel)
    {
      int blockWidth = this.width >> miplevel;
      if (blockWidth < 1)
        blockWidth = 1;
      int blockHeight = this.height >> miplevel;
      if (blockHeight < 1)
        blockHeight = 1;
      return this.GetPixels(0, 0, blockWidth, blockHeight, miplevel);
    }

    [ExcludeFromDocs]
    public Color[] GetPixels() => this.GetPixels(0);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetPixelImpl_Injected(int image, int mip, int x, int y, ref Color color);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void GetPixelImpl_Injected(int image, int mip, int x, int y, out Color ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void GetPixelBilinearImpl_Injected(
      int image,
      int mip,
      float u,
      float v,
      out Color ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void ReadPixelsImpl_Injected(
      ref Rect source,
      int destX,
      int destY,
      bool recalculateMipMaps);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetSafetyHandle_Injected(Texture2D tex, out AtomicSafetyHandle ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void GetSafetyHandleForSlice_Injected(int mipLevel, out AtomicSafetyHandle ret);

    /// <summary>
    ///   <para>Flags used to control the encoding to an EXR file.</para>
    /// </summary>
    [Flags]
    public enum EXRFlags
    {
      /// <summary>
      ///   <para>No flag. This will result in an uncompressed 16-bit float EXR file.</para>
      /// </summary>
      None = 0,
      /// <summary>
      ///   <para>The texture will be exported as a 32-bit float EXR file (default is 16-bit).</para>
      /// </summary>
      OutputAsFloat = 1,
      /// <summary>
      ///   <para>The texture will use the EXR ZIP compression format.</para>
      /// </summary>
      CompressZIP = 2,
      /// <summary>
      ///   <para>The texture will use RLE (Run Length Encoding) EXR compression format (similar to Targa RLE compression).</para>
      /// </summary>
      CompressRLE = 4,
      /// <summary>
      ///   <para>This texture will use Wavelet compression. This is best used for grainy images.</para>
      /// </summary>
      CompressPIZ = 8,
    }
  }
}
